"""
使用while循环实现输出2-3+4-5+6.....+100的和
"""
# while循环
sum0 = 0
i = 2
while i < 101:
    if i % 2 == 0:
        sum0 += i
    else:
        sum0 -= i
    i += 1
print(sum0)


# 一行代码版
print(sum(range(2, 101, 2)) - sum(range(3, 101, 2)))
